// eslint-disable-next-line
import { UserLayout, BasicLayout, RouteView, BlankLayout, PageView } from '@/components/layouts'
import { bxAnaalyse } from '@/core/icons'

export const asyncRouterMap = [

  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '首页' },
    redirect: '/account/center',
    children: [

      {
        path: '/system',
        name: 'system',
        redirect: '/system/menu',
        component: PageView,
        meta: { title: '系统管理', icon: 'setting', permission: [ 'system' ] },
        children: [
          {
            path: '/system/example',
            name: 'example',
            component: () => import('@/pages/system/example/TableList'),
            meta: { title: '例子', keepAlive: true, permission: [ 'example' ] }
          },
          {
            path: '/system/company',
            name: 'company',
            component: () => import('@/pages/system/company/List'),
            meta: { title: '商圈管理', keepAlive: true, permission: [ 'company' ] }
          },
          {
            path: '/system/user',
            name: 'user',
            component: () => import('@/pages/system/user/List'),
            meta: { title: '用户管理', keepAlive: true, permission: [ 'user' ] }
          },
          {
            path: '/system/menu',
            name: 'menu',
            component: () => import('@/pages/system/menu/List'),
            meta: { title: '菜单管理', keepAlive: true, permission: [ 'menu' ] }
          },
          {
            path: '/system/role',
            name: 'role',
            component: () => import('@/pages/system/role/List'),
            meta: { title: '角色管理', keepAlive: true, permission: [ 'role' ] }
          }
        ]
      },

      {
        path: '/business',
        name: 'business',
        redirect: '/business/merchant',
        component: PageView,
        meta: { title: '商圈管理', icon: 'slack', permission: [ 'business' ] },
        children: [
          {
            path: '/business/category',
            name: 'category',
            component: () => import('@/pages/business/category/List'),
            meta: { title: '类别管理', keepAlive: true, permission: [ 'category' ] }
          },
          {
            path: '/business/merchant',
            name: 'merchant',
            component: () => import('@/pages/business/merchant/List'),
            meta: { title: '商户管理', keepAlive: true, permission: [ 'merchant' ] }
          },
          {
            path: '/business/product',
            name: 'product',
            component: () => import('@/pages/business/product/info'),
            meta: { title: '优惠券管理', keepAlive: true, permission: [ 'product' ] }
          },
          {
            path: '/business/chargeproduct',
            name: 'chargeproduct',
            component: () => import('@/pages/business/chargeproduct/info'),
            meta: { title: '收费优惠券管理', keepAlive: true, permission: [ 'chargeproduct' ] }
          },
        ]
      },
      {
        path: '/member',
        name: 'memberMenu',
        redirect: '/member/menu',
        component: PageView,
        meta: { title: '会员管理', icon: 'slack', permission: [ 'memberMenu' ] },
        children: [
          {
            path: '/member/member',
            name: 'member',
            component: () => import('@/pages/member/member/TableList'),
            meta: { title: '会员管理', keepAlive: true, permission: [ 'member' ] }
          },
        ]
      },
      {
        path: '/message',
        name: 'message',
        redirect: '/message/activity',
        component: PageView,
        meta: { title: '消息中心', icon: 'slack', permission: [ 'message' ] },
        children: [
          {
            path: '/message/activity',
            name: 'activity',
            component: () => import('@/pages/message/activity/List'),
            meta: { title: '活动消息', keepAlive: true, permission: [ 'activity' ] }
          },
        ]
      },
      {
        path: '/dashboard',
        name: 'dashboard',
        component: RouteView,
        redirect: '/dashboard/analysis',
        meta: { title: '统计管理', icon: bxAnaalyse, permission: [ 'dashboard' ] },
        children: [
          {
            path: '/dashboard/analysis',
            name: 'Analysis',
            component: () => import('@/pages/dashboard/Analysis/TableList'),
            meta: { title: '分析页', keepAlive: false, permission: [ 'analysis' ] }
          },
          {
            path: '/dashboard/trade',
            name: 'Trade',
            component: () => import('@/pages/dashboard/trade/List'),
            meta: { title: '交易记录', keepAlive: false, permission: [ 'trade' ] }
          },

        ]
      },

      // Exception
      {
        path: '/exception',
        name: 'exception',
        component: RouteView,
        redirect: '/exception/403',
        meta: { title: '异常页', icon: 'warning', permission: [ 'exception' ] },
        children: [
          {
            path: '/exception/403',
            name: 'Exception403',
            component: () => import(/* webpackChunkName: "fail" */ '@/pages/common/exception/403'),
            meta: { title: '403', permission: [ 'exception' ] }
          },
          {
            path: '/exception/404',
            name: 'Exception404',
            component: () => import(/* webpackChunkName: "fail" */ '@/pages/common/exception/404'),
            meta: { title: '404', permission: [ 'exception' ] }
          },
          {
            path: '/exception/500',
            name: 'Exception500',
            component: () => import(/* webpackChunkName: "fail" */ '@/pages/common/exception/500'),
            meta: { title: '500', permission: [ 'exception' ] }
          }
        ]
      },

      // account
      {
        path: '/account',
        component: RouteView,
        redirect: '/account/center',
        name: 'account',
        meta: { title: '个人管理', icon: 'user', keepAlive: true, permission: [ 'user' ] },
        children: [
          {
            path: '/account/center',
            name: 'center',
            component: () => import('@/pages/common/account/center/Index'),
            meta: { title: '个人中心', keepAlive: true, permission: [ 'user' ] }
          },
          /*{
            path: '/account/settings',
            name: 'settings',
            component: () => import('@/pages/common/account/settings/Index'),
            meta: { title: '个人设置', hideHeader: true, permission: [ 'user' ] },
            redirect: '/account/settings/base',
            hideChildrenInMenu: true,
            children: [
              {
                path: '/account/settings/base',
                name: 'BaseSettings',
                component: () => import('@/pages/common/account/settings/BaseSetting'),
                meta: { title: '基本设置', hidden: true, permission: [ 'user' ] }
              },
              {
                path: '/account/settings/security',
                name: 'SecuritySettings',
                component: () => import('@/pages/common/account/settings/Security'),
                meta: { title: '安全设置', hidden: true, keepAlive: true, permission: [ 'user' ] }
              },
              {
                path: '/account/settings/custom',
                name: 'CustomSettings',
                component: () => import('@/pages/common/account/settings/Custom'),
                meta: { title: '个性化设置', hidden: true, keepAlive: true, permission: [ 'user' ] }
              },
              {
                path: '/account/settings/binding',
                name: 'BindingSettings',
                component: () => import('@/pages/common/account/settings/Binding'),
                meta: { title: '账户绑定', hidden: true, keepAlive: true, permission: [ 'user' ] }
              },
              {
                path: '/account/settings/notification',
                name: 'NotificationSettings',
                component: () => import('@/pages/common/account/settings/Notification'),
                meta: { title: '新消息通知', hidden: true, keepAlive: true, permission: [ 'user' ] }
              }
            ]
          }*/
        ]
      },
    ]
  },
  {
    path: '*', redirect: '/404', hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/pages/common/login/Login')
      },
      {
        path: 'register',
        name: 'register',
        component: () => import(/* webpackChunkName: "user" */ '@/pages/common/login/Register')
      },
      {
        path: 'register-result',
        name: 'registerResult',
        component: () => import(/* webpackChunkName: "user" */ '@/pages/common/login/RegisterResult')
      }
    ]
  },
  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/pages/common/exception/404')
  }
]
